package com.waylent.todolist;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

public class ViewPagerAdapter extends FragmentPagerAdapter {

    private List<TaskFragment> mFragments;

    @Override
    public CharSequence getPageTitle(int position) {
        String title = "默认";
        switch (position) {
            case 0:
                title = "最近事情";
                break;
            case 1:
                title = "大事";
                break;
            case 2:
                title = "习惯";
                break;
            case 3:
                title = "梦想";
                break;

        }
        return title;
    }

    ViewPagerAdapter(FragmentManager fm, List<TaskFragment> fragments) {
        super(fm);
        mFragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }
}
